package com.cenntro.oss;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ImportResource;
import org.springframework.stereotype.Component;

//@EnableWebMvc
@ServletComponentScan
// 排除application 数据源配置
@SpringBootApplication(scanBasePackages = { "com.cenntro" }, exclude = {
		// DataSourceAutoConfiguration.class
})
@MapperScan(basePackages = "com.cenntro.**.mapper")
@ImportResource(locations = { "classpath:druid/druid-bean.xml" })
@Component
public class OssApplication  extends SpringBootServletInitializer   {

	public static void main(String[] args) {
		SpringApplication.run(OssApplication.class, args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(OssApplication.class);
	}

//	/**
//	 * 分页组件
//	 * 
//	 * @return
//	 */
//	@Bean
//	public PageHelper pageHelper() {
//		PageHelper pageHelper = new PageHelper();
//		Properties properties = new Properties();
//		properties.setProperty("offsetAsPageNum", "true");  //RowBounds参数offset作为PageNum使用 
//		properties.setProperty("rowBoundsWithCount", "true");  //RowBounds是否进行count查询
//		properties.setProperty("reasonable", "false");        //分页合理化
//		properties.setProperty("dialect", "Mysql"); // 配置postgresql数据库的方言支持Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库
////		properties.setProperty("pageSizeZero", "false");  //当设置为true的时候，如果pagesize设置为0（或RowBounds的limit=0），就不执行分页，返回全部结果
//		//supportMethodsArguments  是否支持接口参数来传递分页参数，默认false
//		pageHelper.setProperties(properties);
//		return pageHelper;
//	}

}
